public class MortgageReport {

    private  MortageCalculator calculator;
    
    public MortgageReport(MortageCalculator calculator) {
        this.calculator = calculator;
    }

    public  void printBalance() {
        double mortgage = calculator.calculateMortgage();
        System.out.println();
        System.out.println("--------------");
        System.out.println("每月还款后余额为：");
        for (short month = 1; month <= this.calculator.getNumberOfPayments(); month++) {
            double balance = calculator.calculateBalance(month);
            System.out.println(String.format("%.3f", balance));
        }
    }

    public  void printMortgage() {
        double mortgage = calculator.calculateMortgage();
        System.out.println();
        System.out.println("--------------");
        System.out.println(String.format("每月还款金额为：%.3f", mortgage));
    }
    
}
